/********************************************************/
/*	Copyright (C) 2012 Gong Li Bin			*/
/*	Project:	MapReduce			*/
/*	Author:		gong_libin			*/
/*	Date:		2013_05_06			*/
/*	File:		MrSquid.h			*/
/********************************************************/

#ifndef	_MRSQUID_H
#define	_MRSQUID_H

#include "MrDb.h"
#include "MrDef.h"
#include "MrTcp.h"
#include "MrPro.h"
#include "MrUtl.h"
#include "MrConf.h"
#include "MrTime.h"
#include "MrMysql.h"
#include "MrPgsql.h"
#include "MrOracl.h"
#include "MrThread.h"

#include <getopt.h>
#include <signal.h>

#define	MR_SD_NULL			0x00
#define	MR_SD_MSQL			0x01
#define	MR_SD_PSQL			0x02
#define	MR_SD_OSQL			0X03

#define	MR_SD_VERSION			"MrSquid-2.0.0"

typedef struct tagMrSquidConf
{
	char m_szHost[MR_VALUE];
	char m_szPort[MR_VALUE];
	char m_szUser[MR_VALUE];
	char m_szPass[MR_VALUE];
	char m_szListen[MR_VALUE];
}MRSQUIDCONF_S;

void MrSquidQuit(int iSignal);
void MrSquidHelp(char* pszProc);
void MrSquidFunction(int iSocket);
void* MrSquidThreadCore(void* pPara);
int MrSquidConfig(UCHAR ucType, char* pszConf);
void MrSquidSqlCore(CMrSql* pCSql, CMrTcp& CTcp, CMrPro& CPro);
void MrSquidMysqlCore(CMrSql* pCSql, CMrTcp& CTcp, CMrPro& CPro, char* pszSql);
void MrSquidPgsqlCore(CMrSql* pCSql, CMrTcp& CTcp, CMrPro& CPro, char* pszSql);
void MrSquidOraclCore(CMrSql* pCSql, CMrTcp& CTcp, CMrPro& CPro, char* pszSql);
void MrSquidResultSend(CMrTcp& CTcp, CMrPro& rCPro, UCHAR ucReturn, MRPROKV_S* pstKv, USHORT usTotal);

#endif /* _MRSQUID_H */
